/*-------------------------------------------------------------------------
 *
 * hio.h
 *	  POSTGRES 堆访问方法输入/输出定义。
 *
 *
 * Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
 * Portions Copyright (c) 1994, Regents of the University of California
 *
 * src/include/access/hio.h
 *
 *-------------------------------------------------------------------------
 */
#ifndef HIO_H
#define HIO_H

#include "access/htup.h"
#include "storage/buf.h"
#include "utils/relcache.h"

/*
 * 批量插入的状态---仅限于 heapam.c 和 hio.c
 *
 * 如果 current_buf 不等于 InvalidBuffer，则我们在该缓冲区上
 * 保留一个额外的引用。
 *
 * "typedef struct BulkInsertStateData *BulkInsertState" 在 heapam.h 中
 */
typedef struct BulkInsertStateData
{
	BufferAccessStrategy strategy;	/* 我们的 BULKWRITE 策略对象 */
	Buffer		current_buf;	/* 当前插入目标页面 */
} BulkInsertStateData;


extern void RelationPutHeapTuple(Relation relation, Buffer buffer,
								 HeapTuple tuple, bool token);
extern Buffer RelationGetBufferForTuple(Relation relation, Size len,
										Buffer otherBuffer, int options,
										BulkInsertStateData *bistate,
										Buffer *vmbuffer, Buffer *vmbuffer_other);

#endif							/* HIO_H */
